package com.xiaobaibai.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaobaibai.dao.UserInfoDao;
import com.xiaobaibai.entity.UserInfo;
import com.xiaobaibai.service.IUserInfoService;
import com.xiaobaibai.threadPool.MyThreadPoolUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xiaobaibai
 * @since 2020-10-16
 */
@Service
public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfo> implements IUserInfoService {

    @Autowired
    private MyThreadPoolUnit myThreadPoolUnit;

    @Override
    //使对应的积分记录表缓存失效
    @CacheEvict(value = "integral",key = "'getUserIntegralDetailByUserId-'+#userId")
    //后续可能还要使个人杂七杂八表缓存失效
    public void addUserInfoIntegral(Integer userId,Integer count) {
        myThreadPoolUnit.addUserInfoIntegral(userId,count);
    }

}
